package MathProblem;

public class test3 {
//    不用运算符 : 算 + - * /


    //你要给的参数溢出,自己活该
    public static int add(int a,int b){
        int sum = a;
        while (b != 0){
            sum = a ^ b;
            b = (a & b) << 1;
            a = sum;
        }
        return sum;
    }
    //相反数
    public static int negNum(int n){
        return add(~n,1);//一个数取反+1
    }
    //减法
    public static int minus(int a, int b){
        return add(a,negNum(b));
    }
    public static int multi(int a ,int b){
        //是不是也能用另一种方式,不能的加
        int res = 0;
        while (b != 0){
            if ((b & 1) != 0){
                res = add(res,a);
            }
            a <<= 1;
            b >>>= 1;
        }
        return res;
    }
    public static int chu(int a,int b){
        int s=0;
        int ys=0;
        while (a >= b){
            a=minus(a,b);
            s++;
        }
        ys = a;
        return s;
    }

    public static void main(String[] args) {
        int a=10;
        int b=2;
        System.out.println(chu(a,b));
    }
}
